#include <stdio.h>
#include <string.h>
#include <stdlib.h>
#include <unistd.h>
#include <aether/msg.h>
#include <aether/window.h>
#include <lvgl.h>

extern void lv_port_disp_init(void);
extern void lv_port_indev_init(void);

void button_event_cb(lv_event_t *e)
{
    printf("Clicked\n");
}

int main()
{
    lv_init();

    lv_port_disp_init();
    lv_port_indev_init();

    lv_obj_set_style_bg_color(lv_screen_active(), lv_color_hex(0x668b8b), LV_PART_MAIN);

    lv_obj_t *button = lv_button_create(lv_screen_active());              /*Add a button to the current screen*/
    lv_obj_center(button);                                                /*Set its position*/
    lv_obj_set_size(button, 100, 50);                                     /*Set its size*/
    lv_obj_add_event_cb(button, button_event_cb, LV_EVENT_CLICKED, NULL); /*Assign a callback to the button*/

    lv_obj_t *label = lv_label_create(button); /*Add a label to the button*/
    lv_label_set_text(label, "Button");        /*Set the labels text*/
    lv_obj_center(label);                      /*Align the label to the center*/

    while (1)
    {
        lv_task_handler();
        usleep(100);
        lv_tick_inc(1);
        __asm__ __volatile__("pause");
    }
}
